<?php
Util::tsRegisterAssetJs('form_wizard.js');
$baseUrl = Yii::app()->baseUrl;
?>
<div class="row-fluid" id="dv_cuenta">
    <?php
    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'id' => 'cuenta-form',
        'type' => 'horizontal',
        'enableAjaxValidation' => true,
        'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
        'enableClientValidation' => false,
    ));
    ?>
    <div class="span8">
        <div class="widget orange">
            <div class="widget-title">
                <h4><i class="icon-briefcase"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . Cuenta::label(); ?></h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                    <!--a href="javascript:;" class="icon-remove"></a-->
                </span>
            </div>
            <div class="widget-body">

                <p class="note"><?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span> <?php echo Yii::t('AweCrud.app', 'are required') ?>.</p>
                <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 64, 'class' => 'span10')) ?>
                <?php echo $form->textFieldRow($model, 'razon_social', array('maxlength' => 64, 'class' => 'span10')) ?>
                <?php echo $form->textFieldRow($model, 'documento', array('maxlength' => 20, 'data-mask' => '00000000000000', 'class' => 'span6')) ?>
                <?php echo $form->dropDownListRow($model, 'industria_id', CHtml::listData(Industria::model()->orden()->findAll(), 'id', Industria::representingColumn()), array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
                <?php echo $form->textFieldRow($model, 'empleados', array('class' => 'span4', 'data-mask' => '000000000')) ?>
                <?php echo $form->textFieldRow($model, 'ingresos_anuales', array('class' => 'span4 money')) ?>
                <?php echo $form->dropDownListRow($model, 'tipo', $model->tipoOpciones, array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
                <?php echo $form->textFieldRow($model, 'website', array('maxlength' => 255, 'class' => 'span6')) ?>
                <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'class' => 'span10')) ?>

                <?php echo $form->hiddenField($model, 'id') ?>
                <!--                <div class="form-actions">
                <?php
//                    $this->widget('bootstrap.widgets.TbButton', array(
////                                        'buttonType' => 'submit',
//                        'type' => 'success',
//                        'icon' => 'ok',
//                        'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
//                        'htmlOptions' => array(
//                            'onClick' => 'js:save("#cuenta-form")')
//                    ));
                ?>
                <?php
//                    $this->widget('bootstrap.widgets.TbButton', array(
//                        'icon' => 'remove',
//                        'label' => Yii::t('AweCrud.app', 'Cancel'),
//                        'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
//                    ));
                ?>
                                </div>-->
            </div>
        </div>
    </div>
    <div class="span4">
        <?php if ($grupos): ?>
            <div class="widget green">
                <div class="widget-title">
                    <h4><i class="icon-archive"></i> Grupos</h4>
                    <span class="tools">
                        <a href="javascript:;" class="icon-chevron-down"></a>
                        <!--a href="javascript:;" class="icon-remove"></a-->
                    </span>
                </div>
                <div class="widget-body">
                    <div class="check-box-list">
                        <?php echo $form->checkBoxList($model, 'grupos', CHtml::listData($grupos, 'id', 'nombre'), array_map('AweHtml::getPrimaryKey', $model->grupos)); ?>
                    </div>
                </div>
            </div>
        <?php endif; ?>

        <div class="widget">
            <div class="widget-title">
                <h4><i class="icon-lock"></i> Permisos</h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                    <!--a href="javascript:;" class="icon-remove"></a-->
                </span>
            </div>
            <div class="widget-body permisos">
                <?php echo $form->dropDownListRow($model, 'owner_id', CHtml::listData(Yii::app()->user->um->listUsers(), 'iduser', 'username'), array('empty' => '- Seleccione -', 'class' => 'span12 fix')) ?>
                <div class="radio-list">
                    <?php echo $form->radioButtonListRow($model, 'permisos', $model->permisosOpciones) ?>
                </div>
            </div>
        </div>
    </div>

</div>
<div id="tab_medios">
    <div class="row-fluid panel" <?php // echo $model->isNewRecord ? 'hidden' : ''       ?>>
        <?php $this->renderPartial('steps/_direcciones', array('model' => $model)) ?>
    </div>
    <div class="row-fluid panel" <?php // echo $model->isNewRecord ? 'hidden' : ''       ?>>
        <div class="span6">
            <?php $this->renderPartial('steps/_emails', array('model' => $model)) ?>
        </div>
        <div class="span6">
            <?php $this->renderPartial('steps/_telefonos', array('model' => $model)) ?>
        </div> 
    </div>
    <div class="row-fluid panel" <?php // echo $model->isNewRecord ? 'hidden' : ''       ?>>
        <div class="span6">
            <?php $this->renderPartial('steps/_redes_sociales', array('model' => $model)) ?>
        </div>
    </div>
    <!--<div class="row-fluid" style="float: right;">-->
    <div class="form-actions-float flotante" style="right: 0; left:initial;">
        <div style="float:right;">
            <a id="btn_finalizar" class="btn btn-large btn-info" type="button" style="<?php echo $model->isNewRecord ? 'display: none' : 'display: inline-block' ?>" href="<?php echo $model->isNewRecord ? '' : $baseUrl.'crm/cuenta/view/id/'.$model->id ?>"><i class="icon-signout icon-white"></i> Finalizar </a>
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
//                                        'buttonType' => 'submit',
                'type' => 'success',
                'icon' => 'ok',
                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                'htmlOptions' => array(
                    'style' => $model->isNewRecord ? 'display: inline-block' : 'display: none',
                    'id' => 'btn_crearCuenta',
                    'class' => 'btn-large',
                    'onClick' => 'js:save("#cuenta-form")')
            ));
            ?>
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'icon' => 'remove',
                'label' => Yii::t('AweCrud.app', 'Cancel'),
                'htmlOptions' => array(
                    'class' => 'btn-large',
                    'onclick' => 'javascript:history.go(-1)')
            ));
            ?>
        </div>
        <!--<div class="offset10">-->

        <!--</div>-->
        <!--<div class="space15"></div>-->
    </div>
    <div class="space15"></div>
    <!--</div>-->
</div>
<?php $this->endWidget(); ?>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/js/gmaps.js"></script>